package com.example.demo.myrouteplan;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.baidu.demo.R;

import java.util.ArrayList;

public class ResultShowActivity extends AppCompatActivity {

    private ListView show_plan_list;
    private ArrayList<String> plannodes = new ArrayList<>();
    private ArrayList<String> allplannodes = new ArrayList<>();
    private int maxdaynum = 1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_result_show);

        show_plan_list = findViewById(R.id.show_plan_list);

        maxdaynum = getIntent().getIntExtra("days", 0);
        for (int i = 0; i < maxdaynum; i++) {
            plannodes = getIntent().getStringArrayListExtra("plannodes" + i);
            if (plannodes != null)
                allplannodes.addAll(plannodes);
            allplannodes.add("");
        }

        ArrayAdapter<String> nodeAdapter = new NodeAdapter(ResultShowActivity.this, R.layout.layout_plannode_item, allplannodes);//刷新listview，可改进？？？？？？
        show_plan_list.setAdapter(nodeAdapter);
    }
}